<?=$this->load->view('include_header',null)?>
<style type="text/css">
form#form textarea {
    height: 50px;
    overflow: auto;
    padding: 5px;
    width: 410px;
}
</style>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
				<?php if(!empty($info->id)):?><li><a id="printInfo" class="folder_table">打印本页信息</a></li><?php endif;?>
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<div id="box">
<!-- table begin -->
<form method="post" id="form"  enctype="multipart/form-data" action="<?=site_url('schengen/jm_update/'.$cateid)?>">

	<h3>牙买加申请表</h3>
    <table width="100%">
    <thead>
        <tr>
          <td colspan="4" align="right"><img src="<?= (@$info->avatar)?@$info->avatar:'images/avatar.gif'?>" width="150" height="150" /></td>
		  <td align="right">
		  上传照片<br />
		  <input type="file" name="userphoto" /><br />
		  (.gif|.jpg|.png文件,最大1M)<br />
		  <?php if (@$info->attachment):?><a href="<?= @$info->attachment?>" target="_blank">点击下载附件</a><?php endif; ?>
		  &nbsp;&nbsp;&nbsp;&nbsp;上传附件<br />
		  <input type="file" name="userfile" /><br />
		  (.pdf|.zip|.rar|.doc,最大2M)		  </td>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <td colspan="5" align="right">			
			<input type="hidden" name="id" value="<?=$id?>" />
			<input id="button1" type="submit" value="提交信息" />
			<input id="button2" type="reset" value="重置" />			</td>
        </tr>
    </tfoot>

    <tbody>
        <tr class="odd">
            <td colspan="5">PLEASE FILL IN THIS FORM IN ENGLISH (请用英文填写该表)</td>
        </tr>
        <tr class="even">
            <td>1.	SURNAME (姓)</td>
            <td><input type="text" name="surname" value="<?= @$info->surname?>" /></td>
            <td>&nbsp;</td>
            <td>FIRST NAME (名)</td>
            <td><input type="text" name="firstname" value="<?= @$info->firstname?>" /></td>
        </tr>
        <tr class="odd">
            <td>2. FORMER NAME (where different from above) 曾用名 (与上不同)</td>
            <td colspan="4"> SURNAME (姓)
              <input type="text" name="other_surname" value="<?= @$info->other_surname?>" />&nbsp;&nbsp;FIRST NAME (名)
              <input type="text" name="other_firstname" value="<?= @$info->other_firstname?>" /></td>
        </tr>
        <tr class="even">
            <td> NATIONALITY (present) (现国籍)</td>
            <td><input type="text" name="cur_nationality" value="<?= @$info->cur_nationality?>" /></td>
            <td>&nbsp;</td>
            <td> (former)(曾有国籍)</td>
            <td><input type="text" name="ori_nationality" value="<?= @$info->ori_nationality?>" /></td>
        </tr>
        <tr class="odd">
            <td>3. DATE OF BIRTH (出生日期)</td>
            <td><select name="birth_d"><?php for($i=1;$i<=31;$i++) echo "<option value='$i'".((@$info->birth_d==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="birth_m"><?php for($i=1;$i<=12;$i++) echo "<option value='$i'".((@$info->birth_m==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="birth_y"><?php for($i=date("Y");$i>1940;$i--) echo "<option value='$i'".((@$info->birth_y==$i)?"selected":"").">$i</option>"; ?></select></td>
            <td>&nbsp;</td>
            <td> SEX (性別)</td>
            <td><input type="radio" name="sex" value="1" <?= (@$info->sex==1)?'checked':''?> />
            Male  (男) 
              <input type="radio" name="sex" value="2" <?= (@$info->sex==2)?'checked':''?> />
              Female ( 女)</td>
        </tr>
        <tr class="even">
          <td> PLACE OF BIRTH (出生地点)</td>
            <td><input type="text" name="birth_place" value="<?= @$info->birth_place?>" /></td>
            <td>&nbsp;</td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr class="odd">
            <td>4.	NAMES, DATES & PLACES OF BIRTH OF MINOR CHILDREN IF ACCOMPANYING YOU(如有携行之未成年者，其姓名, 出生日期及出生地)</td>
			<td colspan="4"><textarea name="childrens_detail"><?= @$info->childrens_detail?></textarea></td>
        </tr>
        <tr class="even">
            <td>5. (a) ADDRESS IN  ENGLISH(地址，英文)</td>
            <td colspan="4"><input type="text" name="en_address" value="<?= @$info->en_address?>" style="width:300px" /></td>
			</tr>
        <tr class="odd">
            <td>TELEPHONE (电话)</td>
            <td><input type="text" name="en_tel" value="<?= @$info->en_tel?>" /></td>
			<td>&nbsp;</td>
			<td>POST CODE (邮编)</td>
            <td><input type="text" name="en_postal" value="<?= @$info->en_postal?>" /></td>
        </tr>
		<tr class="even">
		<td>(b) ADDRESS IN  CHINESE AND POST CODE(地址和邮编，中文) </td>
		<td colspan="4"><input type="text" name="cn_address" value="<?= @$info->cn_address?>" style="width:300px" /></td>
		</tr>
		<tr class="odd">
		<td>6.MARITAL STATUS (婚姻狀況)</td>
		<td colspan="4">
<input type="radio" name="marital_status" value="1" <?= (@$info->marital_status==1)?'checked':''?>/> Married/已婚 	
<input type="radio" name="marital_status" value="2" <?= (@$info->marital_status==2)?'checked':''?>/> Single/未婚 			
<input type="radio" name="marital_status" value="3" <?= (@$info->marital_status==3)?'checked':''?>/> Widowed/丧偶
<input type="radio" name="marital_status" value="4" <?= (@$info->marital_status==4)?'checked':''?>/> Divorced/离异 </td>
		</tr><tr class="even">
		<td>7. DATES(s) OF PREVIOUS VISIT(s) (if any) TO JAMAICA AND  ADDRESS (上次访问牙买加之日期及地址，如有)</td>
		<td colspan="4"><textarea name="pre_visit"><?= @$info->pre_visit?></textarea></td>
		</tr>
		<tr class="odd">
		<td>8. OCCUPATION (职业)</td>
		<td><input type="text" name="occupation" value="<?= @$info->occupation?>" /></td>
		<td></td>
		<td>9. REASON FOR JOURNEY  (此行目的是)</td>
		<td><input type="text" name="purpose" value="<?= @$info->purpose?>" /></td>
		</tr>
		<tr class="even">
		<td colspan="2">10 DATE &amp; PORT OF ARRIVAL IN JAMAICA（到达牙买加日期和口岸）</td>
		<td colspan="3"><input type="text" name="arrival_detail" value="<?= @$info->arrival_detail?>" style="width:300px" /></td>
		</tr>
		<tr class="odd">
		<td colspan="2">DATE &amp; PORT OF DEPARTURE FROM JAMAICA(从牙买加出发日期和口岸）</td>
		<td colspan="3"><input type="text" name="departure_detail" value="<?= @$info->departure_detail?>" style="width:300px" /></td>
		</tr>
		<tr class="even">
		<td>11. PASSPORT NO. (护照号码)</td>
		<td><input type="text" name="travel_document_num" value="<?= @$info->travel_document_num?>" /></td>
		<td></td>
		<td>ISSUED AT (签发地点)</td>
		<td><input type="text" name="travel_document_issue_by" value="<?= @$info->travel_document_issue_by?>" /></td>
		</tr>
		<tr class="odd">
		<td>ISSUED ON (签发日期)</td>
		<td><input type="text" name="travel_document_issue_date" value="<?= @$info->travel_document_issue_date?>" id="travel_document_issue_date" /></td>
		<td></td>
		<td>VALID UNTIL (有效期至)</td>
		<td><input type="text" name="travel_document_valid_date" value="<?= @$info->travel_document_valid_date?>" id="travel_document_valid_date" /></td>
		</tr>
		<tr class="even">
		<td colspan="5">&nbsp;</td>
		</tr>
		<tr class="odd">
		<td colspan="5"><p align="center">REFERENCES IN JAMAICA (牙买加邀请人之资料) <br />
			This section must be completed. (这部分必须填写) </p></td>
		</tr>
		<tr class="even">
		<td>(1) NAME (姓名)</td>
		<td><input type="text" name="ref_name1" value="<?= @$info->ref_name1?>" /></td>
		<td></td>
		<td> TEL (电话)</td>
		<td><input type="text" name="ref_tel1" value="<?= @$info->ref_tel1?>" /></td>
		</tr>
		<tr class="odd">
		<td>ADDRESS (地址)</td>
		<td colspan="4"><input type="text" name="ref_address1" value="<?= @$info->ref_address1?>" /></td>
		</tr>
		<tr class="even">
		<td>(2) NAME (姓名)</td>
		<td><input type="text" name="ref_name2" value="<?= @$info->ref_name2?>" /></td>
		<td></td>
		<td>TEL (电话)</td>
		<td><input type="text" name="ref_tel2" value="<?= @$info->ref_tel2?>" /></td>
		</tr>
		<tr class="odd">
		<td>ADDRESS (地址)</td>
		<td colspan="4"><input type="text" name="ref_address2" value="<?= @$info->ref_address2?>" /></td>
		</tr>
		<tr class="even">
		<td>&nbsp;</td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		</tr>
		<tr class="odd">
		<td>&nbsp;</td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		</tr>
    </tbody>
	</table>
<!-- table end -->
</form>

			</div>
		</div>
		
		<?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
	</div>

<script type="text/javascript">
$().ready(function() {
  $("#form").validate({
    rules: {
		surname:"required",
		firstname:"required",
		cur_nationality:"required",
		marital_status:"required",
		travel_document_num:"required",
		travel_document_issue_by:"required",
		travel_document_issue_date:"required",
		travel_document_valid_date:"required",
    }
  });
  
	$.datepicker.setDefaults(
		{
		dateFormat: 'dd/mm/yy',
		changeMonth: true,
		changeYear: true,
		showOn: "both",
		buttonImage: "images/calendar.gif",
		buttonImageOnly: true
		}
	);
	
	$("#travel_document_issue_date").datepicker();
	$("#travel_document_valid_date").datepicker();
	

	$("#printInfo").click(function(o) {
		var prints = [
			{rel_id: <?=$cateid?>, rec_id: <?=$id?>}
		]  ;
		
		var jdata = JSON.stringify(prints);
		//alert(jdata);
		$.post("<?=site_url('proxy/does/'.str_replace('==','',base64_encode('http://'.$_SERVER['SERVER_NAME'].':9090/javaprduct/servlet/test')))?>",{clients:jdata},function(msg){alert(msg)});
	});
	
	$("#printInfo").ajaxError(function(event,request, settings){
		//$(this).append("<li>出错页面:" + settings.url + "</li>");
		alert("无法访问"+ settings.url );
	}); 
 
});
</script>

<?=$this->load->view('include_footer',null)?>